/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ManagersUI;

import ControladoresUI.AulasInicioController;
import ControladoresUI.SemestresInicioController;
import java.io.IOException;
import java.util.logging.*;
import javafx.fxml.FXMLLoader;
import javafx.scene.*;
import Entidades.Aula;
import Entidades.Semestre;
import Entidades.Usuario;
import javafx.scene.layout.StackPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

/**
 *
 * @author JEscalante
 */
public class SemestresInicioManager {
    private Scene scene;
    private Stage stage;
    public Parent root;
    public AjustesManager ajustesManager;
    public SemestresInicioManager(Scene scene, Stage stage, AjustesManager ajustesManager) {
        this.scene = scene;
        this.stage = stage;
        this.ajustesManager = ajustesManager;
    }
    public void abrirPanelSemestresInicio(){
        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("/VistasUI/pnlSemestresInicio.fxml"));
            root = (Parent) loader.load();
            SemestresInicioController controller = loader.<SemestresInicioController>getController();
            controller.initManager(this);
        } catch (IOException ex) {
            Logger.getLogger(SemestresInicioManager.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public void showPnlSemestresRegistro(){
        scene = new Scene(new StackPane());
        Stage nuevaStage = new Stage();
        nuevaStage.initStyle(StageStyle.UTILITY);
        nuevaStage.initModality(Modality.APPLICATION_MODAL);
        
        SemestresRegistroManager semestresRegistroManager = new SemestresRegistroManager(scene,nuevaStage);
        semestresRegistroManager.showSemestresRegistro(this.ajustesManager);

        nuevaStage.setScene(scene);
        nuevaStage.setTitle("Registro de semestres");
        nuevaStage.show();
    }
    public void showPnlSemestresModificar(Semestre registro){
        scene = new Scene(new StackPane());
        Stage nuevaStage = new Stage();
        nuevaStage.initStyle(StageStyle.UTILITY);
        nuevaStage.initModality(Modality.APPLICATION_MODAL);
        
        SemestresModificarManager semestresModificarManager = new SemestresModificarManager(scene,nuevaStage);
        semestresModificarManager.showSemestresModificar(this.ajustesManager, registro);

        nuevaStage.setScene(scene);
        nuevaStage.setTitle("Modificación de semestres");
        nuevaStage.show();
    }

}
